package cn.itsource.hrm.factory;

import cn.itsource.hrm.client.SearchFeign;
import cn.itsource.hrm.document.CourseDoc;
import cn.itsource.hrm.utils.AjaxResult;
import feign.hystrix.FallbackFactory;

import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
@Slf4j
@Component
public class SearchFeignFactory implements FallbackFactory {
    @Override
    public SearchFeign create (Throwable throwable) {
        return new SearchFeign() {
            @Override
            public AjaxResult onLineCourse (CourseDoc courseDoc) {
                throwable.printStackTrace();
                log.error("参数："+ courseDoc);
                return AjaxResult.me().setSuccess(false).setMessage("ES保存失败！");
            }
        };
    }
}
